/*
 * 版权所有 ( c ) 联想集团有限公司 2005-2009 保留所有权利。
 * 项目：	Lenovo Push Service
 * 文件名：	LibraryDetailsConfiguration.java
 * 版本:    1.0
 * 描述：	
 * 作者：	刘兵召
 * 日期：	May 7, 2010 
 * 修改历史：
 * 【时间】		【修改者】	【修改内容】
 */
package com.feng.demo.jakartacommons.digester;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;

public class LibraryDetailsConfiguration {
	private HashMap movieDetailsMap;

	// movieDetailsMap would store the title as key and
	// MovieDetailsConfiguration object as value
	public LibraryDetailsConfiguration() {
		movieDetailsMap = new HashMap();
	}

	public void setMovieDetailsMap(HashMap movieDetailsMap) {
		this.movieDetailsMap = movieDetailsMap;
	}

	public HashMap getMovieDetailsMap() {
		return movieDetailsMap;
	}

	public void setMovie(MovieDetails movieDetails) {
		movieDetailsMap.put(movieDetails.getTitle(), movieDetails);
	}

	public void printLibraryDetails() {
		Collection movieDetailsColl = this.movieDetailsMap.values();
		if (movieDetailsColl != null) {
			Iterator itMovieDetails = movieDetailsColl.iterator();
			while (itMovieDetails.hasNext()) {
				MovieDetails movieDetails = (MovieDetails) itMovieDetails
						.next();
				System.out.println(movieDetails.getTitle() + " -> "
						+ movieDetails.getRating());
			}
		} else {
			System.out.println("Movie details do not exist");
		}
	}
}